import request from '@/utils/request'

/**
 * 获取部门列表(分页)
 */
export function getDepartmentList(pageNum = 1, pageSize = 10, keyword = '') {
  return request({
    url: '/dept/department/list',
    method: 'get',
    params: { pageNum, pageSize, keyword }
  })
}

/**
 * 获取所有部门(下拉框)
 */
export function getAllDepartments() {
  return request({
    url: '/dept/department/all',
    method: 'get'
  })
}

/**
 * 添加部门
 */
export function addDepartment(data) {
  return request({
    url: '/dept/department/add',
    method: 'post',
    data
  })
}

/**
 * 更新部门
 */
export function updateDepartment(id, data) {
  return request({
    url: `/dept/department/update/${id}`,
    method: 'put',
    data
  })
}

/**
 * 删除部门
 */
export function deleteDepartment(id) {
  return request({
    url: `/dept/department/delete/${id}`,
    method: 'delete'
  })
}
